package com.wsb.boot.controller;

import com.rabbitmq.http.client.domain.ExchangeType;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.concurrent.ExecutorService;

/**
 * @author wang shaobo
 * @date 2020/7/20  17:38
 */
//@Component
public class Consummer {

    @Autowired
    private ExecutorService executorService;

    //监听器队列
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(value = "queue_email",durable = "false"),
//            exchange = @Exchange(
//                    value = "topic.exchange",
//                    ignoreDeclarationExceptions = "true",
//                    type = ExchangeTypes.TOPIC
//            ),
//            key = "{\"topic.#.email.#\",\"email.*\"}"))
    public void rece_email(String msg){
        System.out.println(" [邮件服务] received : " + msg + "!");
    }


    //监听器队列
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(value = "queue_sms",durable = "false"),
//            exchange = @Exchange(
//                    value = "topic.exchange",
//                    ignoreDeclarationExceptions = "true",
//                    type = ExchangeTypes.TOPIC
//            ),
//            key = "{\"topic.#.sms.#\"}"))
    public void rece_sms(String msg){
        System.out.println(" [短信服务] received : " + msg + "!");
    }

}
